import React, { useState } from 'react';
import {
  MenuFoldOutlined,
  MenuUnfoldOutlined,
  UploadOutlined,
  UserOutlined,
  VideoCameraOutlined,
} from '@ant-design/icons';
import { Layout, Menu, Button, theme, Dropdown } from 'antd';
import { Outlet } from 'react-router-dom';
import MyMenu from '../components/MyMenu';
import { Link } from "react-router-dom"
import MyUserMenu from '../components/MyUserMenu';
const { Header, Sider, Content } = Layout;

const items = [
  {
    key: '1',
    label: <Link to="/">退出登录</Link>,
  },
  {
    key: '2',
    label: "修改密码",
  },

];

const Home = () => {
  const [collapsed, setCollapsed] = useState(false);
  const {
    token: { colorBgContainer },
  } = theme.useToken();
  return (
    <Layout style={{ minHeight: "100vh" }}>
      <Sider trigger={null} collapsible collapsed={collapsed}>
        <div className="demo-logo-vertical">
          <img width="180px" src="http://web.woniulab.com:8084/img/logo-250px.645f24b5.png" alt="" />
        </div>
        <MyMenu theme="dark"></MyMenu>
      </Sider>
      <Layout>
        <Header
          style={{
            padding: 10,
            boxSizing: "border-box",
            background: colorBgContainer,
            display: "flex",
            justifyContent: "space-between"
          }}
        >
          <Button
            type="text"
            icon={collapsed ? <MenuUnfoldOutlined /> : <MenuFoldOutlined />}
            onClick={() => setCollapsed(!collapsed)}
            style={{
              fontSize: '16px',
              width: 64,
              height: 64,
            }}
          />
          <Dropdown
            menu={{
              items,
            }}
            placement="bottom"
            arrow={{
              pointAtCenter: true,
            }}
          >
            <Button>bottom</Button>
          </Dropdown>
        </Header>
        <Content
          style={{
            margin: '24px 16px',
            padding: 24,
            minHeight: 280,
            background: colorBgContainer,
          }}
        >
          <MyUserMenu></MyUserMenu>
          <Outlet></Outlet>
        </Content>
      </Layout>
    </Layout>
  );
};
export default Home;